<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="单据编号" prop="code">
        <el-input
          v-model="queryParams.code"
          placeholder="请输入单据编号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="源单据号" prop="sourceCode">
        <el-input
          v-model="queryParams.sourceCode"
          placeholder="请输入源单据号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="单据阶段" prop="docStage">
        <el-input
          v-model="queryParams.docStage"
          placeholder="请输入单据阶段"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="单据日期" prop="docDate">
        <el-date-picker clearable
                        v-model="queryParams.docDate"
                        type="date"
                        value-format="yyyy-MM-dd"
                        placeholder="请选择单据日期">
        </el-date-picker>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['caigou:buyComparePrice:add']"
        >新增
        </el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['caigou:buyComparePrice:edit']"
        >修改
        </el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['caigou:buyComparePrice:remove']"
        >删除
        </el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['caigou:buyComparePrice:export']"
        >导出
        </el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="buyComparePriceList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center"/>
<!--      <el-table-column label="主键" align="center" prop="id"/>-->
      <el-table-column label="单据编号" align="center" prop="code" width="200" fixed="left"/>
      <el-table-column label="源单据号" align="center" prop="sourceCode" width="200"/>
      <el-table-column label="单据阶段" align="center" prop="docStage">
        <template slot-scope="scope">
          <span v-if="scope.row.docStage == 0">编制完</span>
          <span v-if="scope.row.docStage == 1">执行中</span>
          <span v-if="scope.row.docStage == 2">执行完</span>
        </template>
      </el-table-column>
      <el-table-column label="单据日期" align="center" prop="docDate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.docDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="是否生效" align="center" prop="isEffect">
        <template slot-scope="scope">
          <span v-if="scope.row.isEffect == 0 || scope.row.isEffect == undefined || scope.row.isEffect == null">否</span>
          <span v-else>是</span>
        </template>
      </el-table-column>
      <el-table-column label="是否关闭" align="center" prop="isClose">
        <template slot-scope="scope">
          <span v-if="scope.row.isClose == 0 || scope.row.isClose == undefined || scope.row.isClose == null">否</span>
          <span v-else>是</span>
        </template>
      </el-table-column>
      <el-table-column label="是否作废" align="center" prop="isCancel">
        <template slot-scope="scope">
          <span v-if="scope.row.isCancel == 0 || scope.row.isCancel == undefined || scope.row.isCancel == null">否</span>
          <span v-else>是</span>
        </template>
      </el-table-column>
      <el-table-column label="制单人" align="center" prop="docMakeUserName"/>
      <el-table-column label="创建人" align="center" prop="createBy"/>
      <el-table-column label="创建时间" align="center" prop="createTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="修改人" align="center" prop="updateBy"/>
      <el-table-column label="修改时间" align="center" prop="updateTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="备注" align="center" prop="remark"/>
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="200" fixed="right">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['caigou:buyComparePrice:edit']"
          >修改
          </el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['caigou:buyComparePrice:remove']"
          >删除
          </el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改采购比价对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="1300px" append-to-body
               :close-on-click-modal="false"
               :close-on-press-escape="false">
      <el-form ref="form" :model="form" :rules="rules" inline label-width="80px">
        <el-form-item label="单据编号" prop="code">
          <el-input v-model="form.code" placeholder="请输入单据编号"/>
        </el-form-item>
        <el-form-item label="采购询价" prop="sourceCode">
          <el-input v-model="form.sourceCode" placeholder="" readonly/>
        </el-form-item>
        <el-form-item>
          <el-button plain @click="selectBuyAsk">采购询价</el-button>
        </el-form-item>
        <el-form-item label="单据日期" prop="docDate">
          <el-date-picker clearable
                          v-model="form.docDate"
                          type="date"
                          value-format="yyyy-MM-dd"
                          placeholder="请选择单据日期">
          </el-date-picker>
        </el-form-item>
        <el-tabs v-model="activeName" @tab-click="handleClick">
          <el-tab-pane label="报价单" name="first">
            <el-button type="primary" icon="el-icon-plus" @click="selectGybj">报价单</el-button>
            <el-table
              :data="cgbjList"
              border>
              <el-table-column prop="code" label="单据编号"/>
              <el-table-column prop="sourceCode" label="源单据编号"/>
              <el-table-column prop="supplierName" label="供应商"/>
            </el-table>
            <el-button plain icon="el-icon-arrow-right" @click="addGybjGoodsForCgbjGoods">添加</el-button>

            <template v-for="cgbjGoodsList in cgbjGoodsListByProName">

              <h2>商品：{{ cgbjGoodsList.proName }}---报价明细</h2>
              <el-divider></el-divider>
              <el-table :data="cgbjGoodsList.List">
                <el-table-column width="30">
                  <template slot-scope="scope">
                    <el-radio
                      class="radio"
                      :label="scope.row"
                      v-model="SelectionChangeGybjGoodsCurrentRow"
                    >&emsp;&emsp;&emsp;
                    </el-radio>
                  </template>
                </el-table-column>

                <el-table-column
                  prop="id"
                  label="主键"
                  width="50">
                </el-table-column>
                <el-table-column
                  prop="buySuppliesCode"
                  label=供应报价编号"
                  width="180"
                ></el-table-column>
                <el-table-column
                  prop="supplierName"
                  label="供应商"
                  width="100"
                ></el-table-column>
                <el-table-column
                  prop="proCode"
                  label="编码"
                  width="180">
                </el-table-column>
                <el-table-column
                  prop="proName"
                  label="名称"
                  width="180">
                </el-table-column>
                <el-table-column
                  prop="typeName"
                  label="类型">
                </el-table-column>
                <el-table-column
                  prop="number"
                  label="数量"
                  fixed="right">
                </el-table-column>
                <el-table-column
                  prop="unitName"
                  label="单位"
                  fixed="right">
                </el-table-column>
                <el-table-column
                  prop="price"
                  label="含税单价"
                  width="100"
                  fixed="right">
                </el-table-column>
                <el-table-column
                  prop="tax"
                  label="税率"
                  width="100"
                  fixed="right">
                  <template slot-scope="scope">
                    <!--                  <el-input v-model="scope.row.tax"  oninput ="value=value.replace(/[^0-9.]/g,'')" placeholder="请输入(整数或者小数)金额" />-->
                    <el-select v-model="scope.row.tax" placeholder="请选择" disabled>
                      <el-option
                        v-for="item in [{value:0.00,label:'0%'},{value:0.03,label:'3%'},{value:0.05,label:'5%'}]"
                        :key="item.value"
                        :label="item.label"
                        :value="item.value">
                      </el-option>
                    </el-select>
                  </template>

                </el-table-column>

                <el-table-column
                  label="含税金额"
                  width="200"
                  fixed="right">
                  <template slot-scope="scope">
                    <el-input :value="scope.row.number * scope.row.price " readonly/>

                  </template>
                </el-table-column>
              </el-table>
            </template>
          </el-tab-pane>
          <el-tab-pane label="明细" name="second">
            <el-table :data="cgbjGoodsListDetails">

              <el-table-column
                prop="id"
                label="主键"
                width="50">
              </el-table-column>
              <el-table-column
                prop="buySuppliesCode"
                label="采购报价编号"
                width="180"
              ></el-table-column>
              <el-table-column
                prop="supName"
                label="供应商"
                width="100"
              ></el-table-column>
<!--              <el-table-column-->
<!--                prop="proCode"-->
<!--                label="编码"-->
<!--                width="180">-->
<!--              </el-table-column>-->
              <el-table-column
                prop="proName"
                label="名称"
                width="180">
              </el-table-column>
              <el-table-column
                prop="typeName"
                label="类型">
              </el-table-column>
              <el-table-column
                prop="number"
                label="数量"
                fixed="right">
              </el-table-column>
              <el-table-column
                prop="unitName"
                label="单位"
                fixed="right">
              </el-table-column>
              <el-table-column
                prop="price"
                label="含税单价"
                width="100"
                fixed="right">
                <!--                <template slot-scope="scope">-->
                <!--                  <MyNumberInput :point="2" :max="99999" placeholder="请输入金额" v-model.number="scope.row.price"></MyNumberInput>-->
                <!--                  &lt;!&ndash;                  <input  type="number" v-model="scope.row.price" placeholder="请输入扣分" οnkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')"/>&ndash;&gt;-->
                <!--                  &lt;!&ndash;                  <el-input v-model="scope.row.price"  oninput ="value=value.replace(/[^0-9.]/g,'')" placeholder="请输入(整数或者小数)金额" />&ndash;&gt;-->
                <!--                </template>-->
              </el-table-column>
              <el-table-column
                prop="tax"
                label="税率"
                width="100"
                fixed="right">
                <template slot-scope="scope">
                  <!--                  <el-input v-model="scope.row.tax"  oninput ="value=value.replace(/[^0-9.]/g,'')" placeholder="请输入(整数或者小数)金额" />-->
                  <el-select v-model="scope.row.tax" placeholder="请选择" disabled>
                    <el-option
                      v-for="item in [{value:0.00,label:'0%'},{value:0.03,label:'3%'},{value:0.05,label:'5%'}]"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value">
                    </el-option>
                  </el-select>
                </template>

              </el-table-column>

              <el-table-column
                label="含税金额"
                width="200"
                fixed="right">
                <template slot-scope="scope">
                  <el-input :value="scope.row.number * scope.row.price " readonly/>

                </template>
              </el-table-column>
            </el-table>
          </el-tab-pane>
        </el-tabs>
      </el-form>

      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>

    <!--    选择采购询价单弹窗-->
    <el-dialog
      title="采购询价单"
      :visible.sync="dialogVisibleSelectBuyAsk"
      width="1000px"
      :close-on-click-modal="false"
      :close-on-press-escape="false">
      <SelectBuyAsk ref="selectBuyAskRef"/>

      <span slot="footer" class="dialog-footer">
              <el-button @click="cancelSelectBuyAsk">取 消</el-button>
             <el-button type="primary" @click="sureSelectBuyAsk">确 定</el-button>
             </span>
    </el-dialog>

    <!--    选择选择供应报价单弹窗-->
    <el-dialog
      title="供应报价单"
      :visible.sync="dialogVisibleSelectGybj"
      width="1000px"
      :close-on-click-modal="false"
      :close-on-press-escape="false">
      <SelectGybj ref="selectGybjRef"/>

      <span slot="footer" class="dialog-footer">
              <el-button @click="cancelSelectGybj">取 消</el-button>
             <el-button type="primary" @click="sureSelectgybj">确 定</el-button>
             </span>
    </el-dialog>
  </div>
</template>

<script>
import {
  listBuyComparePrice,
  getBuyComparePrice,
  delBuyComparePrice,
  addBuyComparePrice,
  updateBuyComparePrice, addBuyComparePricePlus, updateBuyComparePricePlus, getBuyComparePriceInfo
} from "@/api/caigou/buyComparePrice";
import SelectBuyAsk from "@/views/caigou/gysbj/SelectBuyAsk.vue";
import SelectGybj from "@/views/caigou/buyComparePrice/SelectGybj.vue";
import {getCaigouxunjiaInfoByCode} from "@/api/caigou/caigouxunjia";
import {listGysbj} from "@/api/caigou/gysbj";
import {getGybjGoodsByCodeBuySupCode} from "@/api/caigou/gysbjGoods";
import MyNumberInput from "@/views/caigou/gysbj/MyNumberInput.vue";
import item from "@/layout/components/Sidebar/Item.vue";


export default {
  name: "BuyComparePrice",
  components: {MyNumberInput, SelectBuyAsk, SelectGybj},
  data() {
    return {
      //被选中的供应报价商品
      SelectionChangeGybjGoodsCurrentRow: null,
      //采购比价明细List
      cgbjGoodsListDetails: [],
      cgbjGoodsListByProName: [],
      //对应供应报价下的商品列表
      cgbjGoodsList: [],
      //对应采购询价单下的供应报价
      cgbjList: [],
      activeName: 'first',
      dialogVisibleSelectGybj: false,
      dialogVisibleSelectBuyAsk: false,
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 采购比价表格数据
      buyComparePriceList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        code: null,
        sourceCode: null,
        docStage: null,
        docDate: null,
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        code: [
          {required: true, message: "单据编号不能为空", trigger: "blur"}
        ],
        sourceCode: [
          {required: true, message: "采购询价编号不能为空", trigger: "blur"}
        ],
        docDate:[
          {required: true, message: "单据日期不能为空", trigger: "blur"}
        ]
      }
    };
  },
  created() {
    this.getList();
  },
  methods: {
    //处理选中
    handleSelectionChangeGybjGoodsList(val) {
      this.SelectionChangeGybjGoodsList = val;
      console.log('handleSelectionChangeGybjGoodsList', val)
    },
    //添加供应报价商品至采购比价商品
    addGybjGoodsForCgbjGoods() {
      let newArr = [];
      newArr.push({...this.SelectionChangeGybjGoodsCurrentRow, compareSort: 1,supName:this.SelectionChangeGybjGoodsCurrentRow.supplierName})
      newArr.forEach(item => {
        this.cgbjGoodsListDetails.forEach(good => {
          if (good.proCode != item.proCode) {
            newArr.push({...good, compareSort: 1,sourceCode:good.buySuppliesCode,supName:good.supplierName});
          }
        })
      })

      this.cgbjGoodsListDetails = newArr;
      console.log(this.SelectionChangeGybjGoodsCurrentRow)
      console.log('cgbjGoodsListDetails', this.cgbjGoodsListDetails)


    },
    getCgbjGoodsList() {
      if (this.cgbjList.length === 0) {
        this.$modal.msgWarning("请选择供应报价")
        return;
      }
      let codeArr = [];
      this.cgbjList.forEach(item => {
        codeArr.push(item.code);
      })
      console.log(codeArr)
      getGybjGoodsByCodeBuySupCode(codeArr).then(res => {
        // console.log('getGybjGoodsByCodeBuySupCode',this.cgbjList);
        this.cgbjGoodsList = res.data;
        this.cgbjGoodsList.forEach(cgbjGoods => {
          this.cgbjList.forEach(cgbj => {
            if (cgbjGoods.buySuppliesCode == cgbj.code) {
              cgbjGoods.supplierName = cgbj.supplierName;
              cgbjGoods.supId = cgbj.supplierId;

            }
          })
        })
        this.cgbjGoodsListSplitArray();
      })


    },
    cgbjGoodsListSplitArray() {
      let arr = this.cgbjGoodsList;
      let goodsArr = [];
      arr.map(mapItem => {
        if (goodsArr.length == 0) {
          goodsArr.push({proName: mapItem.proName, List: [mapItem]})
        } else {
          let res = goodsArr.some(item => {
            if (item.proName == mapItem.proName) {
              item.List.push(mapItem)
              return true
            }
          })
          if (!res) {
            goodsArr.push({proName: mapItem.proName, List: [mapItem]})
          }
        }
      })
      // this.cgbjGoodsListByProName = goodsArr;
      console.log('cgbjGoodsListByProName', goodsArr);

      // goodsArr = [];
      goodsArr.forEach(item => {
        this.cgbjGoodsListByProName.push({proName: item.proName, List: item.List.sort((a, b) => a.price - b.price)})
      })
      console.log('sort', this.cgbjGoodsListByProName)
      // this.cgbjGoodsListByProName = goodsArr;
      // this.cgbjGoodsListByProName = goodsArr;

    },
    sureSelectgybj() {
      // this.$refs.selectGybjRef.get
      this.cgbjList = this.$refs.selectGybjRef.returnSelectGybjList();

      this.dialogVisibleSelectGybj = false;
      this.getCgbjGoodsList();
    },
    cancelSelectGybj() {
      this.dialogVisibleSelectGybj = false;
    },
    selectGybj() {
      this.cgbjGoodsListByProName = [];
      if (this.form.sourceCode == undefined || this.form.sourceCode == null || this.form.sourceCode == '') {
        this.$message.warning('请选择采购询价单')
        return;
      }
      this.dialogVisibleSelectGybj = true;
      setTimeout(() => {
        this.$refs.selectGybjRef.queryBySourceCode(this.form.sourceCode);
      }, 100)
    },
    handleClick(tab, event) {
      console.log(tab, event);
    },
    cancelSelectBuyAsk() {
      this.form.sourceCode = '';
      this.dialogVisibleSelectBuyAsk = false;
    },
    sureSelectBuyAsk() {
      let currentBuyAsk = this.$refs.selectBuyAskRef.returnBuyAsk();
      if (currentBuyAsk == undefined || currentBuyAsk == null) {
        this.$message.warning('请选择采购询价单')
        return;
      }
      this.form.sourceCode = currentBuyAsk.code;
      console.log(currentBuyAsk);

      this.dialogVisibleSelectBuyAsk = false;
    },
    // 选择采购询价单
    selectBuyAsk() {
      this.dialogVisibleSelectBuyAsk = true;
      //对应供应报价下的商品列表
      this.cgbjGoodsList = [];
      //对应采购询价单下的供应报价
      this.cgbjList = [];
      this.SelectionChangeGybjGoodsCurrentRow = null;
      //采购比价明细List
      this.cgbjGoodsListDetails = [];
      this.cgbjGoodsListByProName = [];

    },
    /** 查询采购比价列表 */
    getList() {
      this.loading = true;
      listBuyComparePrice(this.queryParams).then(response => {
        this.buyComparePriceList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
      //对应供应报价下的商品列表
      this.cgbjGoodsList = [];
      //对应采购询价单下的供应报价
      this.cgbjList = [];

      //被选中的供应报价商品
      this.SelectionChangeGybjGoodsCurrentRow = [];
      //采购比价明细List
      this.cgbjGoodsListDetails = [];
      this.cgbjGoodsListByProName = [];
      //对应供应报价下的商品列表
      this.cgbjGoodsList = [];
      //对应采购询价单下的供应报价
      this.cgbjList = [];
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        code: 'CGBJ-' + Date.now(),
        sourceCode: null,
        docStage: null,
        docDate: null,
        docMakeUserId: null,
        approvalResult: null,
        approvalRemark: null,
        approvalUserId: null,
        isEffect: null,
        isClose: null,
        isCancel: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
        remark: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length !== 1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加采购比价";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids
      getBuyComparePriceInfo(id).then(response => {
        this.form = response.data.buyComparePrice;
        this.cgbjGoodsListDetails = response.data.buyComparePriceGoods;
        console.log('cgbjGoodsListDetails',response.data)
        this.open = true;
        this.title = "修改采购比价";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            this.form.updateBy = this.$store.getters.name
            updateBuyComparePricePlus({
              'buyComparePrice': this.form,
              'buyComparePriceGoods': this.cgbjGoodsListDetails
            }).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            this.form.createBy = this.$store.getters.name
            addBuyComparePricePlus({
              'buyComparePrice': this.form,
              'buyComparePriceGoods': this.cgbjGoodsListDetails
            }).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
          this.cgbjGoodsList = [];
          //对应采购询价单下的供应报价
          this.cgbjList = [];

          //被选中的供应报价商品
          this.SelectionChangeGybjGoodsCurrentRow = [];
          //采购比价明细List
          this.cgbjGoodsListDetails = [];
          this.cgbjGoodsListByProName = [];
          //对应供应报价下的商品列表
          this.cgbjGoodsList = [];
          //对应采购询价单下的供应报价
          this.cgbjList = [];
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除采购比价编号为"' + ids + '"的数据项？').then(function () {
        return delBuyComparePrice(ids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {
      });
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('caigou/buyComparePrice/export', {
        ...this.queryParams
      }, `buyComparePrice_${new Date().getTime()}.xlsx`)
    }
  }
};
</script>
